package com.inossem.warehousestorage_inossem.request.inventory.chuangyou;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.inventory.chuangyou.InventoryMatsBean;
import com.inossem.warehousestorage_inossem.bean.inventory.chuangyou.InventoryMatsRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * 查询仓位物料信息
 *
 * @author 詹建宇
 * @time on 2018/4/2 9:42
 * @email jianyu.zhan@inossem.com
 */
public class InventoryMatsRequest extends Request {

    public static String request(Context context, String position_id, String stocktake_id, GsonBeanListener gsonBeanListener) {
        String tag;
        InventoryMatsRequestBean bean = new InventoryMatsRequestBean();
        bean.setPosition_id(position_id);
        bean.setStocktake_id(stocktake_id);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InventoryMatsRequestBean.class);
        String url = RequestManage.getUrl(context, RequestConstant.URL_INVENTORY_POSITIONS_MATS);
        tag = RequestManage.getHttpsPostWithLoading(context, url, json, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                InventoryMatsBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), InventoryMatsBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }

}
